﻿Imports System.ComponentModel

Public Class BaseViewModel
  Implements INotifyPropertyChanged


  Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

  Public Sub OnPropertyChanged(ByVal ltPropName As String)
    If Not PropertyChangedEvent Is Nothing Then
      RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(ltPropName))
    End If
  End Sub

  Private Shared _isInDesignMode As System.Nullable(Of Boolean)

  ''' <summary>
  ''' Gets a value indicating whether the control is in design mode (running in Blend
  ''' or Visual Studio).
  ''' </summary>
  Public Shared ReadOnly Property IsInDesignModeStatic() As Boolean
    Get
      If Not _isInDesignMode.HasValue Then
#If SILVERLIGHT Then
			_isInDesignMode = DesignerProperties.IsInDesignTool
#Else
        Dim prop = DesignerProperties.IsInDesignModeProperty
#End If
        _isInDesignMode = CBool(DependencyPropertyDescriptor.FromProperty(prop, GetType(FrameworkElement)).Metadata.DefaultValue)
      End If

      Return _isInDesignMode.Value
    End Get
  End Property

End Class
